import request from '@/config/axios'

// 信用贷款 VO
export interface CreditLoanVO {
  id: number // 编号
  name: string // 姓名
  phone: string // 手机号
  city: string // 城市
  qualifications: string // 资质列表
  loanAmount: number // 申请额度
  loanTerm: number // 贷款期数
}

// 信用贷款 API
export const CreditLoanApi = {
  // 查询信用贷款分页
  getCreditLoanPage: async (params: any) => {
    return await request.get({ url: `/weiyi/credit-loan/page`, params })
  },

  // 查询信用贷款详情
  getCreditLoan: async (id: number) => {
    return await request.get({ url: `/weiyi/credit-loan/get?id=` + id })
  },

  // 新增信用贷款
  createCreditLoan: async (data: CreditLoanVO) => {
    return await request.post({ url: `/weiyi/credit-loan/create`, data })
  },

  // 修改信用贷款
  updateCreditLoan: async (data: CreditLoanVO) => {
    return await request.put({ url: `/weiyi/credit-loan/update`, data })
  },

  // 删除信用贷款
  deleteCreditLoan: async (id: number) => {
    return await request.delete({ url: `/weiyi/credit-loan/delete?id=` + id })
  },

  // 导出信用贷款 Excel
  exportCreditLoan: async (params) => {
    return await request.download({ url: `/weiyi/credit-loan/export-excel`, params })
  }
}